<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const mapData = [
            { name: '南海诸岛', value: 0 },
            { name: '北京', value: 0 },
            { name: '天津', value: 0 },
            { name: '上海', value: 0 },
            { name: '福建', value: 0 }
        ]
        let data = [
            { name: '江西省', value: 4 },
            { name: '天津市', value: 1 },
            { name: '北京市', value: 2 },
            { name: '福建省', value: 5 },
            { name: '浙江省', value: 1 },
            { name: '宁夏回族自治区', value: 4 }
        ]
        // let arr = []
        mapData.forEach(item => {
            let res = data.find(it => {
                if (it.name.indexOf(item.name) !== -1) {

                    it.name = item.name
                }
                return it.name === item.name
            })
            // console.log(res)
            if (res) {
                item.value = res.value
                // console.log(item)
            }
        })
        console.log(mapData)

    //     let res = data.find(it => it.name === item.name)
    //     if (res) {
    //         item.value = res.value
    //     }
    // })

        // console.log(mapData)
    </script>
</body>

</html>